package com.chenglu.android.store.adapter;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.common.utils.GlideUtils;
import com.chenglu.android.common.utils.Utils;
import com.chenglu.android.index.bean.IndexRecomBean;
import com.chenglu.android.store.bean.ChartBangBean;

import java.util.List;

/**
 * @author: lyj
 * @Created: by Copyright 2023 10 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：搜索历史
 */
public class BangAdapter extends BaseQuickAdapter<IndexRecomBean.Data.Records, BaseViewHolder> {

    Context context;
//    List<HomeLike.Data.Records> data;
    public BangAdapter(Context context, @Nullable List<IndexRecomBean.Data.Records> data) {
        super(R.layout.item_bang_layout, data);
        this.context = context;

    }


    @Override
    protected void convert(@NonNull BaseViewHolder helper, IndexRecomBean.Data.Records item) {

        if (item == null) {
            return;
        }

            ImageView imageView = helper.getView(R.id.iv_goods_img);
            GlideUtils.setImageView(mContext,item.getGoodsImg(),imageView,8);

//            GlideUtils.setImageView(mContext,item.getGoodsImg(),imageView,8);
            helper.setText(R.id.tv_item_title,item.getGoodsName());
            helper.setText(R.id.tv_sell_number,"已售"+ item.getSalesAmount()+"件");
            helper.setText(R.id.tv_price, Utils.formatZeroNumber(item.getGoodsPrice())+"");

//            if(helper.getAdapterPosition()==0){
//             helper.setText(R.id.tv_top_bg,"TOP\n01")
//             .setBackgroundRes(R.id.tv_top_bg,R.drawable.corners_store_top1);
//
//            }else if(helper.getAdapterPosition()==1){
//                helper.setText(R.id.tv_top_bg,"TOP\n02")
//                        .setBackgroundRes(R.id.tv_top_bg,R.drawable.corners_store_top2);
//            }else if(helper.getAdapterPosition()==2){
//                helper.setText(R.id.tv_top_bg,"TOP\n03")
//                        .setBackgroundRes(R.id.tv_top_bg,R.drawable.corners_store_top3);
//            }

    }
}
